You are here: Symbol Reference > Dew Namespace > Dew.Signal Namespace > Dew.Signal.Units Namespace > Classes > SignalUtils Class > SignalUtils Methods > SignalUtils.KaiserFirLength Method
Dew Signal for .NET
ContentsIndexHome
Example

Design a highpass filter with at least 80 dB attenuation in the stopband and not more then 0.0001 ripple in the passband. Transition band is between 0.5 and 0.6 Hz. Sampling frequency is 2 Hz.

using Dew.Math; using Dew.Math.Editors; using Dew.Math.Units; using Dew.Signal; using Dew.Signal.Units; using Dew.Math.Tee; using Dew.Signal.Tee; private void button1_Click(object sender, EventArgs e) { Vector h = new Vector(0); Vector response = new Vector(0); double FS = 2; double Ripple = 0.0001; int n = SignalUtils.KaiserFirLength(new double[2] {0.5,0.6}, Ripple, FS); n = Math387.EnsureRange(4, n, SignalUtils.MaxFirLength); if (n % 2 == 0) { n++; //must be odd, if passband at FS/2 } SignalUtils.FirImpulse(h.Size(n), new double[2] { 0.5, 0.6 }, TFilterType.ftHighpass, FS); //get impulse response SignalUtils.Kaiser(h,SignalUtils.KaiserBetaFir(Ripple)); //apply Kaiser window SignalUtils.FrequencyResponse(h,null,response,8,false,TSignalWindowType.wtRectangular,0); //zero padd by 8x MtxVecTee.DrawIt(20*MtxExpr.Log10(MtxExpr.Abs(response)),"Highpass FIR filter",false); }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.